package com.southpark.demo.managers
{
	import com.southpark.system.interfaces.managers.IApplicationManager;
	import com.southpark.system.interfaces.managers.ITextManager;
	
	import flash.events.EventDispatcher;
	
	import mx.resources.IResourceManager;
	import mx.resources.ResourceBundle;
	import mx.resources.ResourceManager;
	

	public class TextManager extends EventDispatcher implements ITextManager
	{
		
		public function TextManager(applicationManager:IApplicationManager)
		{
			this.applicationManager = applicationManager;
			resourceManager = ResourceManager.getInstance();
		}
		
		
		/**
		 * 
		 */
		private var applicationManager:IApplicationManager;
		
		[ResourceBundle("labels")] 
	 	private static var resourceBundle:ResourceBundle;
		
		private const DEFAULT_LOCALE:String = "en_US";
		private var resourceManager:IResourceManager;
		
		
		public function getText(resourceName:String,parameters:Array=null):String
		{
			return resourceManager.getString("labels",resourceName,parameters);
		};
		

		public function setLanguage(locale:String):void
		{
			resourceManager.localeChain = [locale,DEFAULT_LOCALE];
		}
		
	}
}